<?php echo $this->element('menu'); ?>
<div class="codetails index">

<?php if($codetails):?>
	<h2><?php __('Codetails');$paginator->options(array('url' => array($keyword)));?></h2>
	<?php echo $this->Html->link(__('Export to csv file', true), array('controller' => 'codetails','action' =>'export_code',$keyword)); ?><br><br>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th class="actions"><?php __('Actions');?></th>
			<th><?php echo $this->Paginator->sort('ComID');?></th>
			<th><?php echo $this->Paginator->sort('ComName');?></th>
			<th><?php echo $this->Paginator->sort('StartDate');?></th>
			<th><?php echo $this->Paginator->sort('EndDate');?></th>
			<th><?php echo $this->Paginator->sort('Code');?></th>
			<th><?php echo $this->Paginator->sort('CodeY');?></th>
			<th><?php echo $this->Paginator->sort('Exch');?></th>
			<th><?php echo $this->Paginator->sort('Cat');?></th>
			<th><?php echo $this->Paginator->sort('Type');?></th>			
			<th><?php echo $this->Paginator->sort('LinkedComID');?></th>
			<th><?php echo $this->Paginator->sort('Listed');?></th>
			<th><?php echo $this->Paginator->sort('ISIN');?></th>
			<th><?php echo $this->Paginator->sort('GICS');?></th>
			<th><?php echo $this->Paginator->sort('IndustryGroup');?></th>
			<th><?php echo $this->Paginator->sort('Activit');?></th>
			<th><?php echo $this->Paginator->sort('Website');?></th>
			<th><?php echo $this->Paginator->sort('Announce');?></th>
			<th><?php echo $this->Paginator->sort('AnnRep');?></th>
			<th><?php echo $this->Paginator->sort('InvCtr');?></th>
			<th><?php echo $this->Paginator->sort('Email');?></th>
			<th><?php echo $this->Paginator->sort('Rating');?></th>
			<th><?php echo $this->Paginator->sort('CoAddr');?></th>
			<th><?php echo $this->Paginator->sort('CoTel');?></th>
			<th><?php echo $this->Paginator->sort('CoFax');?></th>
			<th><?php echo $this->Paginator->sort('Regry');?></th>
			<th><?php echo $this->Paginator->sort('CoSec');?></th>			
	</tr>
	<?php
	$i = 0;
	foreach ($codetails as $codetail):
		$class = null;
		if ($i++ % 2 == 0) {
			$class = ' class="altrow"';
		}
	?>
	<tr<?php echo $class;?>>
	<td class="actions">
			<?php echo $this->Html->link(__('View', true), array('action' => 'view', $codetail['Codetail']['ComID'])); ?>
			<?php echo $this->Html->link(__('Edit', true), array('action' => 'edit', $codetail['Codetail']['ComID'])); ?>
			<?php echo $this->Html->link(__('Delete', true), array('action' => 'delete', $codetail['Codetail']['ComID']), null, sprintf(__('Are you sure you want to delete # %s?', true), $codetail['Codetail']['ComID'])); ?>
		</td>
		<td><?php echo $codetail['Codetail']['ComID']; ?></td>
		<td><?php echo $codetail['Codetail']['ComName']; ?></td>
		<td><?php if($codetail['Codetail']['StartDate']!="0000-00-00"){echo date("d/m/Y",strtotime($codetail['Codetail']['StartDate']));} ?></td>
		<td><?php if($codetail['Codetail']['EndDate']!="0000-00-00")echo date("d/m/Y",strtotime($codetail['Codetail']['EndDate'])); ?></td>
		<td><?php echo $codetail['Codetail']['Code']; ?></td>
		<td><?php echo $codetail['Codetail']['CodeY']; ?></td>
		<td><?php echo $codetail['Codetail']['Exch']; ?></td>
		<td><?php echo $codetail['Codetail']['Cat']; ?></td>
		<td><?php echo $codetail['Codetail']['Type']; ?></td>
		<td><?php echo $codetail['Codetail']['LinkedComID']; ?></td>
		<td><?php if($codetail['Codetail']['Listed']!="0000-00-00") echo date("d/m/Y",strtotime($codetail['Codetail']['Listed'])); ?></td>
		<td><?php echo $codetail['Codetail']['ISIN']; ?></td>
		<td><?php echo $codetail['Codetail']['GICS']; ?></td>
		<td><?php echo $codetail['Codetail']['IndustryGroup']; ?></td>
		<td><?php echo $this->Text->truncate($codetail['Codetail']['Activit'],50,array('ending'=>'...','exact'=>false)); ?></td>
		<td><?php echo $codetail['Codetail']['Website']; ?></td>
		<td><?php echo $codetail['Codetail']['Announce']; ?></td>
		<td><?php echo $codetail['Codetail']['AnnRep']; ?></td>
		<td><?php echo $codetail['Codetail']['InvCtr']; ?></td>
		<td><?php echo $codetail['Codetail']['Email']; ?></td>
		<td><?php echo $codetail['Codetail']['Rating']; ?></td>
		<td><?php echo $codetail['Codetail']['CoAddr']; ?></td>
		<td><?php echo $codetail['Codetail']['CoTel']; ?></td>
		<td><?php echo $codetail['Codetail']['CoFax']; ?></td>
		<td><?php echo $codetail['Codetail']['Regry']; ?></td>
		<td><?php echo $codetail['Codetail']['CoSec']; ?></td>
		
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
	));
	?>	</p>

	<div class="paging">
		<?php echo $this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>
	 | 	<?php echo $this->Paginator->numbers();?>
 |
		<?php echo $this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>
	</div>
<?php endif;?>	
</div>
